<template>
	<view class="container">
		<nav-bar :title="$t('公告列表')" leftIcon="left" ></nav-bar>
		<view class="listMain">
			<view class="leftList" v-for="(item,i) in textValue" :key="i">
				<view class="text">
					{{lang == 'en'?item.contentEnglish:item.contentChineseTraditional}}
				</view>
				<view class="time">
					{{$t('時間')}}：{{item.createTimeStr}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import apiFn from '@/hooks/myCirculation.js'
	const {
		addUserAroundFlow,
		getMyFlowMoney
	} = apiFn()
	import {
		ref
	} from "vue";
	import homeIndex from '@/hooks/index.js'
	import i18n from '@/locale/index'
	import {
		onShow
	} from "@dcloudio/uni-app"	
	const {
		getGgApi
	} = homeIndex()
	import {
		onReachBottom
	} from '@dcloudio/uni-app'

	const page = ref({
		pageNum: 1,
		pageSize: 11
	})
	const textValue = ref([])
	//列表字段
	const lang = ref('')
	const getGgLIst = async () => {
		let list = {
			pageNum:1,
			pageSize:9999,
		}
		const data = await getGgApi('user/getAnnouncement',list)
		lang.value = uni.getStorageSync('lang')
		textValue.value = data.records
		// ggList.value = data
	}
	async function getRechargeRecordList() {
		const res = await getGgApi('order/queryUserIdAroundFlow', {
			userId: uni.getStorageSync('setUserInfo').userId,
			pageNum: page.value.pageNum,
			pageSize: page.value.pageSize
		})
		if (!res.records.length) {
			return uni.showToast({
				title: `${i18n.global.t('没有更多了')}!`,
				icon: 'none',
			})
		}
		list.value = [...list.value, ...res.records]
	}
	// getRechargeRecordList()
	onShow(async () => {
		getGgLIst()
	})
	//上拉加载更多
	onReachBottom(() => {
		page.value.pageNum++
		getRechargeRecordList()
	})
</script>

<style lang="scss" scoped>
	.listMain {
		padding: 25rpx 45rpx;
		.time {
			color: #808492;
			font-size: 24rpx;
			margin-top: 22rpx;
		}
		.leftList{
			padding: 30rpx;
			background: #24232C;
			margin-bottom: 20rpx;
			border-radius: 20rpx;
			width: 600rpx;
		}
		.text {
			color: #FFFFFF;
			font-size: 28rpx;
			 word-break: break-all;
			white-space: normal;
			width: 600rpx;
		}

	}
</style>